<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<LINK href="images/css.css" type="text/css" rel="stylesheet">
<script type="text/javascript">

	function checkForm() {
		var code = document.getElementById("code").value;
		var name = document.getElementById("name").value;
				
		if (code == 0) {
			alert("请输入等级及语言代码！");
			return false;
		}
		if (name == 0) {
			alert("请输入等级及语言！");
			return false;
		}
	}
</script>
</head>
<body>
<center>
    <table class="tableline" id="Table1" cellspacing="1" cellpadding="0" width="100%" border="0">
      <html:form action="rank.do?method=save" method="post" onsubmit="return checkForm();">
      <tr>
        <td class="STYLE4" align="center" bgcolor="#ffffff" colspan="2" height="40">添加修改报名语言</td>
      </tr>
      <tr>
        <td width="250" height="26" align="right" bgcolor="#ffffff"><font face="宋体">等级及语言代码:</font></td>
        <td width="78%" align="left" bgcolor="#ffffff" class="mddile">
          &nbsp;<html:text property="code" value="${rank.code }"/><font color="red">${rankIdError }${rankIdRequest }</font></td>
      </tr>
      <tr class="mddile">
        <td align="right" bgcolor="#ffffff" height="26"><font face="宋体">等级及语言:</font></td>
        <td align="left" bgcolor="#ffffff">&nbsp;<html:text property="name" value="${rank.name }"/>&nbsp; 
       <html:submit value="增加等级" />&nbsp;<font color="red" >${rankNameError }</font></td>
      </tr>
      </html:form>
      <tr>
        <td bgcolor="#ffffff" colspan="2">
          <table width="100%" cellpadding="0" cellspacing="0" class="mddile">
                <tr align="center">
                  <td width="25%" height="26"><font face="宋体">代码号</font></td>
                  <td width="25%"><font face="宋体">等级及语言</font></td>
                  <td width="25%">是否开<font face="宋体">启</font></td>
                  <td width="25%" >操作</td>
            	</tr>
            <c:if test="${!empty rankList}">
				<c:forEach items="${rankList}" var="rank">
                <tr align="center">
                  <td height="26">${rank.code }</td>
                  <td><font face="宋体">${rank.name }</font></td>
                  <td>
                  <c:if test="${rank.flag == 0 }">未开启
          		  </c:if>
          		  <c:if test="${rank.flag == 1 }"><font color="red">已开启</font>
          		  </c:if>
                  </td>
                  <td>
                  <c:if test="${rank.flag == 0 }"><a href="rank.do?method=updateRankFlag&id=${rank.id }" >开启</a>
          		  </c:if>
          		  <c:if test="${rank.flag == 1 }"><a href="rank.do?method=updateRankFlag&id=${rank.id }" >关闭</a>
          		  </c:if>
                  &nbsp;<a href="rank.do?method=update&id=${rank.id }">编辑</a>&nbsp;<a href="rank.do?method=delete&id=${rank.id }">删除</a></td>
                </tr>
             </c:forEach>
             </c:if>
          </table>
        </td>
      </tr>
    </table>
</center>
</body>
</html>